﻿//Converts form pixels to image pixels

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OCRGUI2008
{
    class PixelCalc
    {
        int mousepixel;
        int imagepixel;
        int controlpixel;

        public PixelCalc(int _mousepixel, int _imagepixel, int _controlpixel)
        {
             mousepixel=_mousepixel;
             imagepixel=_imagepixel;
             controlpixel = _controlpixel;
        }
        ~PixelCalc()
        {
            
        }

        public int CalculatePixels()
        {
            int newpixels = 0;

            double imagepix = Convert.ToDouble(imagepixel);
            double mousepix = Convert.ToDouble(mousepixel);
            double controlpix = Convert.ToDouble(controlpixel);

            double dblnewPixels = mousepix / (controlpix / imagepix);

            newpixels = Convert.ToInt32(dblnewPixels);

            

            return newpixels;

           
        }
    }
}
